package com.ugoodtech.mdcc.client.controller.ResponseObject;

import com.ugoodtech.mdcc.core.Constants;
import com.ugoodtech.mdcc.core.domain.CustomerRegularReport;
import com.ugoodtech.mdcc.core.domain.UserProfile;
import com.ugoodtech.mdcc.core.repository.UserProfileRepository;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;

public class ServiceResponse {

    private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT);

    private Long stationId = 0L;

    private Long reportId = 0L;

    private String stationName = "";

    private String address = "";

    private String userName = "";

    private String dateTime = "";

    private Integer[] reportNum;

    private Integer report_finished;

    public ServiceResponse(CustomerRegularReport report, String realName) {
        this.stationId = report.getRegularReport().getStation().getId();
        this.reportId = report.getRegularReport().getId();
        this.stationName = report.getRegularReport().getStation().getName();
        this.report_finished = report.getRegularReport().getStation().getReport_finished();
        String province = "";
        String city = "";
        if (StringUtils.isNotEmpty(report.getRegularReport().getStation().getProvince())) {
            province = report.getRegularReport().getStation().getProvince();
        }
        if (StringUtils.isNotEmpty(report.getRegularReport().getStation().getCity())) {
            city = report.getRegularReport().getStation().getCity();
            if (province.equals(city)) {
                this.address = province;
            } else {
                this.address = province + city;
            }
        }
        this.userName = realName;
        this.dateTime = simpleDateFormat.format(report.getRegularReport().getUpdateTime());
    }

    public Long getStationId() {
        return stationId;
    }

    public void setStationId(Long stationId) {
        this.stationId = stationId;
    }

    public Long getReportId() {
        return reportId;
    }

    public void setReportId(Long reportId) {
        this.reportId = reportId;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDateTime() {
        return dateTime;
    }

    public void setDateTime(String dateTime) {
        this.dateTime = dateTime;
    }

    public Integer[] getReportNum() {
        return reportNum;
    }

    public void setReportNum(Integer[] reportNum) {
        this.reportNum = reportNum;
    }
}
